package o;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.util.Log;
import com.google.android.gms.common.annotation.KeepForSdk;
import com.google.android.gms.common.internal.ShowFirstParty;
import javax.annotation.CheckReturnValue;

@ShowFirstParty
@CheckReturnValue
@KeepForSdk
public class aon {
    private static aon ˏ;
    private final Context ˊ;

    private aon(Context context) {
        this.ˊ = context.getApplicationContext();
    }

    @KeepForSdk
    public static aon ˏ(Context context) {
        apa.ˊ((Object) context);
        synchronized (aon.class) {
            if (ˏ == null) {
                apv.ॱ(context);
                ˏ = new aon(context);
            }
        }
        return ˏ;
    }

    public static boolean ॱ(PackageInfo packageInfo, boolean z) {
        if (!(packageInfo == null || packageInfo.signatures == null)) {
            aps ˊ;
            if (z) {
                ˊ = ˊ(packageInfo, apx.ˎ);
            } else {
                ˊ = ˊ(packageInfo, apx.ˎ[0]);
            }
            if (ˊ != null) {
                return true;
            }
        }
        return false;
    }

    private static aps ˊ(PackageInfo packageInfo, aps... o_apsArr) {
        int i = 0;
        if (packageInfo.signatures == null) {
            return null;
        }
        if (packageInfo.signatures.length != 1) {
            Log.w("GoogleSignatureVerifier", "Package has more than one signature.");
            return null;
        }
        apz o_apz = new apz(packageInfo.signatures[0].toByteArray());
        while (i < o_apsArr.length) {
            if (o_apsArr[i].equals(o_apz)) {
                return o_apsArr[i];
            }
            i++;
        }
        return null;
    }
}
